gdk/wayland: Break only implicit grabs on wl_pointer.leave w/ pressed buttons
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 3 Jun 2021 14:18:28 +0000 (16:18 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 3 Jun 2021 15:13:12 +0000 (17:13 +0200)
commit8288d9e87cbae1605bd474666eec2099ccd3e973
tree6facf1212f07f4ca53be5ebeeac2f5374b2dd084
parentc2d82c23e69c70c36a2578e9cd2a619e7fc273d7
gdk/wayland: Break only implicit grabs on wl_pointer.leave w/ pressed buttons

The releasing of grabs while a button is pressed (e.g. after starting dnd, or
dragging the window, or going to overview with a pressed button, etc...) was
generalized here in https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1879.

However we shouldn't break all grabs here. In the case of grabbing popups,
compositors will still emit crossing events between client surfaces (e.g.
popping up and selecting a menu item via press-drag-release), breaking all
grabs here means inconsistent client state, that was
https://gitlab.gnome.org/GNOME/gtk/-/issues/2746.

That was fixed in mutter, by essentially making implicit grabs
owner_events=FALSE, however that breaks the mentioned use pattern entirely.
Mutter is changing this behavior back, so GTK should handle these crossing
events.

The grab that we are interested in breaking here is the implicit pointer
one. Popups will be dismissed via other means if the compositor says their
active grab needs breaking. This still leaves dnd/move/resize drags in
one place, while not allowing #2746 to happen with popups.
gdk/wayland/gdkdevice-wayland.c